package jdk;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * SSS.java created by zhangzhidong 
 * at 上午10:39:16 2016年10月15日
 */

/**
 * @author zhangzhidong<br>
 * comment generated at 2016年10月15日上午10:39:16<br>
 * 
 */
public class SSS {
	//12A 34B
	public static void main(String args[]) {
		AtomicBoolean lock = new AtomicBoolean(true);
		Thread t1 = new T1(lock);
		Thread t2 = new T2(lock);
		t1.start();
		t2.start();
	}
static class T1 extends Thread{
		AtomicBoolean lock = null;
		public T1(AtomicBoolean b){
			this.lock = b;
		}
		public void run(){

			for(int i=1;i<=52;){
				while(!lock.get()){
				}	
				System.out.print(i++);
				System.out.print(i++);
				lock.set(false);
			}
		}
	}
static	class T2 extends Thread{
		AtomicBoolean lock = null;
		public T2(AtomicBoolean b){
			this.lock = b;
		}
		public void run(){
			for(char i='A';i<='Z';i++){
				while(lock.get()){
				}	
				System.out.print(i);
				lock.set(true);
			}
		}
	}
	
}

